@page "/Scatter_Chart"
@inject NavigationManager NavigationManager
@inject HttpClient HttpClient

<Scatter Config="config1" OnFirstRender="onChart1_FirstRender" />


<Divider>动手实验</Divider>
<DynamicExample @ref="@example">
    <Scatter @ref="@chart" />
</DynamicExample>

@code{

    public IChartComponent chart;
    DynamicExample example;

    protected override void OnAfterRender(bool firstRender)
    {
        base.OnAfterRender(firstRender);
        example.Chart = chart;
    }


    #region 示例1

    private async Task onChart1_FirstRender(IChartComponent chart)
    {
        var data1 = await DemoData.IMDBAsync(NavigationManager, HttpClient);
        await chart.ChangeData(data1);
    }

    ScatterConfig config1 = new ScatterConfig()
        {
            XField = "revenue",
            YField = "rating",
            Shape = "circle",
            ColorField = "genre",
            Size = 4,
            YAxis = new ValueTimeAxis()
            {
                Nice = true,
                Line = new BaseAxisLine()
                {
                    Style = new LineStyle()
                    {
                        Stroke = "#aaa"
                    }
                }
            },
            XAxis = new ValueTimeAxis()
            {
                Min = -100,
                Grid = new BaseAxisGrid()
                {
                    Line = new BaseAxisGridLine()
                    {
                        Style = new LineStyle()
                        {
                            Stroke = "#aaa"
                        }
                    }
                }
            }
        };


    #endregion 示例1


}

